package com.geeklei.media.ui.controller;

import java.util.ArrayList;
import java.util.List;

public class LifeCycleManager implements LifeCycle {
    List<LifeCycle> mQueue = new ArrayList();

    public void add(LifeCycle lifeCycle) {
        if (lifeCycle != null && !this.mQueue.contains(lifeCycle)) {
            this.mQueue.add(lifeCycle);
        }
    }

    public void remove(LifeCycle lifeCycle) {
        if (lifeCycle != null && this.mQueue.contains(lifeCycle)) {
            this.mQueue.remove(lifeCycle);
        }
    }

    public void onCreate() {
        for (LifeCycle onCreate : this.mQueue) {
            onCreate.onCreate();
        }
    }

    public void onStart() {
        for (LifeCycle onStart : this.mQueue) {
            onStart.onStart();
        }
    }

    public void onResume() {
        for (LifeCycle onResume : this.mQueue) {
            onResume.onResume();
        }
    }

    public void onPause() {
        for (LifeCycle onPause : this.mQueue) {
            onPause.onPause();
        }
    }

    public void onStop() {
        for (LifeCycle onStop : this.mQueue) {
            onStop.onStop();
        }
    }

    public void onDestroy() {
        for (LifeCycle onDestroy : this.mQueue) {
            onDestroy.onDestroy();
        }
    }
}
